home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
398
/
398.xpi
/
chrome
/
forecastfox.jar
/
content
/
utilities
/
error-item.js
< prev
next >
Wrap
Text File
|
2010-02-04
|
2KB
|
83 lines
/*------------------------------------------------------------------------------
Copyright (c) 2008 Ensolis, LLC. All Rights Reserved.
----------------------------------------------------------------------------*/
/******************************************************************************
* Interfaces used by a services for describing error that may occur.
*
* @status FROZEN
* @version 1.0
******************************************************************************/
function ErrorItem()
{
this._properties = {};
this.setProperty("severity", SEVERITY_INFO);
this.setProperty("name", "");
this.setProperty("message", "");
}
ErrorItem.prototype = {
__proto__: new ItemBase("ErrorItem"),
////////////////////////////////
// ffIErrorItem
/**
* Severity of the error.
*/
get severity() { return this.getProperty("severity"); },
/**
* Name of the error. Can be used as a short message.
*/
get name() { return this.getProperty("name"); },
/**
* Long error message. Used often as a tooltip.
*/
get message() { return this.getProperty("message"); },
/**
* Initialize an error item.
*
* @param Severity of the error.
* @param Name of the error.
* @param Message for the error.
*/
init: function ErrorItem_init(aSeverity, aName, aMessage)
{
this.setProperty("severity", aSeverity);
this.setProperty("name", aName);
this.setProperty("message", aMessage);
},
/**
* Convert an error item to a string. Used in logging.
*
* @return A JS string representation of the error.
*/
toString: function ErrorItem_toString()
{
//get the severity string
var severity = "";
switch (this.severity) {
case SEVERITY_WARNING:
severity = "Warning";
break;
case SEVERITY_ERROR:
severity = "Error";
break;
case SEVERITY_INFO:
severity = "Informational";
break;
}
//create the return string
var rv = "[severity: " + severity + ", ";
rv += "name: " + this.name + ", ";
rv += "message: " + this.message + "]";
//return the string
return rv;
}
};